package lsl.leetCode.year2023.test0205;

/**
 * 344. 反转字符串
 *
 * @author Zed
 * @description
 * @date 2023/2/5 19:19
 */
public class test344 {
    public static void main(String[] args) {
        char[] s = {'h', 'e', 'l', 'l', 'o'};
        reverseString(s);
    }

    public static char[] reverseString(char[] s) {
        int n = s.length;
        for (int i = 0; i < n; i++) {
            if (i < n - 1 - i) {
                char temp = s[i];
                s[i] = s[n - 1 - i];
                s[n - 1 - i] = temp;
            }
        }
        return s;
    }
}
